﻿@model FujiyBlog.Core.DomainObjects.PostComment
@{
    ViewBag.Title = "Edit";
    Layout = MVC.Admin.Comment.Views._Layout;
}
<h2>
    Edit</h2>
@using (Html.BeginForm())
{
    @Html.ValidationSummary(true)
    <fieldset>
        <legend>PostComment</legend>
        @Html.HiddenFor(model => model.Id)
        @if (Model.Author == null)
        { 
            <div class="editor-label">
                @Html.LabelFor(model => model.AuthorName)
            </div>
            <div class="editor-field">
                @Html.EditorFor(model => model.AuthorName)
                @Html.ValidationMessageFor(model => model.AuthorName)
            </div>

            <div class="editor-label">
                @Html.LabelFor(model => model.AuthorEmail)
            </div>
            <div class="editor-field">
                @Html.EditorFor(model => model.AuthorEmail)
                @Html.ValidationMessageFor(model => model.AuthorEmail)
            </div>

            <div class="editor-label">
                @Html.LabelFor(model => model.AuthorWebsite)
            </div>
            <div class="editor-field">
                @Html.EditorFor(model => model.AuthorWebsite)
                @Html.ValidationMessageFor(model => model.AuthorWebsite)
            </div>
        }
        else
        { 
            <div class="editor-label">
                @Html.LabelFor(model => model.Author.Username)
            </div>
            <div class="editor-field">
                @Html.TextBoxFor(model => model.Author.Username, new { @readonly = "readonly" })
            </div>

            <div class="editor-label">
                @Html.LabelFor(model => model.Author.Email)
            </div>
            <div class="editor-field">
                @Html.TextBoxFor(model => model.Author.Email, new { @readonly = "readonly" })
            </div>
        }
        <div class="editor-label">
            @Html.LabelFor(model => model.Comment)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Comment)
            @Html.ValidationMessageFor(model => model.Comment)
        </div>
        <p>
            <input type="submit" value="Save" />
        </p>
    </fieldset>
}
<div>
    @Html.ActionLink("Back to List", "Index")
</div>
